<template>
	<div class="scroll">
		<!-- 查询区域 -->
		<ax-form-box ref="formBox" :form-params="queryParam" :form-item-col="5" :label-width="55">
			<div slot="action">
				<a-button type="primary" icon="search" @click="searchQuery">查询</a-button>
				<a-button type="primary" icon="reload" @click="searchReset">重置</a-button>
			</div>
		</ax-form-box>
		<a-form layout="inline" @submit.prevent="searchQuery">
			<a-form-item label="用户姓名">
				<a-input placeholder="请输入姓名查询" v-model="queryParam.userName"> </a-input>
			</a-form-item>
			<a-form-item label="邮箱">
				<a-input placeholder="请输入邮箱查询" v-model="queryParam.email"> </a-input>
			</a-form-item>
			<a-form-item label="手机号码">
				<a-input placeholder="请输入手机号码查询" v-model="queryParam.phone"> </a-input>
			</a-form-item>
			<!-- <a-form-item label="状态">
				<a-select v-model="queryParam.status" placeholder="请选择用户状态查询" style="width;200px">
					<a-select-option value=""> 请选择用户状态</a-select-option>
					<a-select-option value="1"> 正常</a-select-option>
					<a-select-option value="2"> 冻结</a-select-option>
				</a-select>
			</a-form-item> -->
			<span style="overflow: hidden; float: right" class="table-page-search-submitButtons">
				<a-button type="primary" icon="search" @click="searchQuery">查询</a-button>
				<a-button type="primary" icon="reload" @click="searchReset">重置</a-button>
			</span>
		</a-form>
		<!-- table区域 begin -->
		<div>
			<a-button type="primary" ghost icon="search" @click="setSelectValue">选择</a-button>
			<a-table
				ref="table"
				bordered
				size="middle"
				rowKey="id"
				:loading="loading"
				:columns="columns"
				:dataSource="dataSource"
				:pagination="ipagination"
				:rowSelection="{
					selectedRowKeys: selectedRowKeys,
					onChange: onSelectChange,
				}"
			></a-table>
		</div>
	</div>
</template>

<script>
export default {
	name: 'searchUserTable',
	// mixins: [RcListMixin],
	data() {
		return {
			FormData: [],
			description: '这是用户管理页面',
			columns: [
				{
					title: '真实姓名',
					align: 'center',
					width: 100,
					dataIndex: 'userName',
				},
				{
					title: '手机号码',
					align: 'center',
					width: 130,
					dataIndex: 'phone',
				},

				{
					title: '用户角色',
					align: 'center',
					width: 100,
					dataIndex: 'userposition',
				},
				{
					title: '用户类型',
					align: 'center',
					width: 130,
					dataIndex: 'userType_dictext',
				},
				{
					title: '邮箱',
					align: 'center',
					width: 100,
					dataIndex: 'email',
				},
				// {
				// 	title: '状态',
				// 	align: 'center',
				// 	width: 100,
				// 	dataIndex: 'status_dictText',
				// },
				{
					title: '操作',
					align: 'center',
					width: 170,
					scopedSlots: { customRender: 'action' },
					dataIndex: 'action',
				},
			],
			url: {
				list: '/sys/user/list',
				delete: '/sys/user/delete',
				deleteBach: '/sys/user/deleteBach',
			},
		};
	},
	methods: {
		setSelectValue() {
			if (this.selectionRows.length === 0) {
				this.$message.warning('请选择数据项!');
				return false;
			} else if (this.selectionRows.length > 1) {
				this.$message.warning('仅能选择一个数据项!');
				return false;
			} else {
				//返回值给父节点
				this.$emit('getInfo', this.selectionRows[0]);
			}
		},
		loadData() {
			this.dataSource = [];
			// let params = this.getQueryParams();
			this.loading = true;
			api.list(params).then((res) => {
				this.dataSource = res.data.records;
				this.ipagination.total = res.data.total;
				this.loading = false;
			});
		},
		getQueryParams() {
			//获取查询条件
			let sqp = {};
			// if(this.superQuerParms){
			// 	sqp['superQueryParams'=encodeURI(this.superQ)]
			// }
		},
	},
	mounted() {},
};
</script>

<style scoped>
.scroll {
	height: 500px;
	overflow-y: scroll;
}
</style>
